# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ignacio Galmarino <igalmarino@gmail.com>

pkgname=openresolv
pkgver=3.13.1
pkgrel=1
pkgdesc="resolv.conf management framework (resolvconf)"
url="https://roy.marples.name/projects/openresolv"
arch=(any)
license=(custom:BSD)
provides=(resolvconf)
depends=(bash)
makedepends=(
  git
  systemd
)
backup=(etc/resolvconf.conf)
_commit=1afa8e2c1c7bdd5362afb2cc482e85fb01cf5f6d  # tags/v3.13.1^0
source=("git+https://github.com/NetworkConfiguration/openresolv#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgname
}

build() {
  local configure_options=(
    --prefix=/usr
    --sysconfdir=/etc
    --libexecdir=/usr/lib/resolvconf
    --sbindir=/usr/bin
  )

  cd $pkgname
  ./configure "${configure_options[@]}"
  make
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 LICENSE
}

# vim:set sw=2 sts=-1 et:
